import { Pipe, PipeTransform } from '@angular/core';
import { TaskStatus } from 'app/modules/task/services/task.service';

@Pipe({
	name: 'taskStatus',
})
export class TaskStatusPipe implements PipeTransform {
	transform(value: any, args?: any): any {
		switch (value) {
			case TaskStatus.All:
				return '全部状态';
			case TaskStatus.Waiting:
				return '已挂起';
			case TaskStatus.Running:
				return '执行中';
			case TaskStatus.Finish:
				return '已完成';
			case TaskStatus.Failed:
				return '失败';
			case TaskStatus.Cancel:
				return '已取消';
			case TaskStatus.Pause:
				return '已暂停';
		}
		return value;
	}
}
